﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Web.Mvc;

namespace SAKS.Helpers
{
    public static class RolesCheckedHelper
    {
        public static HtmlString RolesChecked(this HtmlHelper helper, string[] checkeds, string[] allRoles)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var role in allRoles)
            {
                sb.Append("<td>");
                sb.Append("<input type='checkbox' id='"+role+"' ");
                if (checkeds.Contains(role))
                    sb.Append("checked='checked'");
                sb.Append("/>");
                sb.Append("</td>");
            }

            return new HtmlString(sb.ToString());
        }
    }
}